package com.xxs.directive;

import java.io.IOException;
import java.io.Writer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.dom4j.Element;

import com.jfinal.template.Directive;
import com.jfinal.template.Env;
import com.jfinal.template.expr.ast.ExprList;
import com.jfinal.template.stat.Scope;
import com.xxs.utils.xml.XmlDom4jUtils;

public class InfoListDirective extends Directive {

	public void setExprList(ExprList exprList){
		super.setExprList(exprList);
	}
	
	@Override
	public void exec(Env env, Scope scope, Writer writer) {
		String siteCode = exprList.eval(scope).toString();
		
		Map data1 = new HashMap<>();
		data1.put("qwe", "111111");
		scope.setData(data1);
		try {
			writer.write("wwwwwww");
		} catch (IOException e) {
			e.printStackTrace();
		}
//		try {
//			List<Element> elements = XmlDom4jUtils.getElements("10001/model","info");
//			writer.write("<select name='modelInfoId' lay-filter='aihao'>");
//			for (int i = 0; i < elements.size(); i++) {
//				Element element = elements.get(i);
//				System.out.println("顶级name："+element.getName());
//				System.out.println("顶级attr："+element.attributeValue("name"));
//				writer.write("<option value='"+element.attributeValue("id")+"'>"+element.attributeValue("name")+"</option>");
//			}
//			writer.write("</select>");
//		} catch (IOException e) {
//			e.printStackTrace();
//		}
	}
	public boolean hasEnd(){
		return true;
	}
	
}
